#ifndef __I2CLIB_H__
#define __I2CLIB_H__
#pragma once
#include <Windows.h>
#include "SerialIoI2cRegs.h"
//  PCH LP & H Serial IO I2C #0 Controller
#define PCI_DEVICE_NUMBER_PCH_SERIAL_IO_I2C0          21
#define PCI_FUNCTION_NUMBER_PCH_SERIAL_IO_I2C0        0
//  PCH LP & H Serial IO I2C #1 Controller
#define PCI_DEVICE_NUMBER_PCH_SERIAL_IO_I2C1          21
#define PCI_FUNCTION_NUMBER_PCH_SERIAL_IO_I2C1        1
//  PCH LP & H Serial IO I2C #2 Controller
#define PCI_DEVICE_NUMBER_PCH_SERIAL_IO_I2C2          21
#define PCI_FUNCTION_NUMBER_PCH_SERIAL_IO_I2C2        2
//  PCH LP & H Serial IO I2C #3 Controller
#define PCI_DEVICE_NUMBER_PCH_SERIAL_IO_I2C3          21
#define PCI_FUNCTION_NUMBER_PCH_SERIAL_IO_I2C3        3
//  PCH LP & H Serial IO I2C #4 Controller
#define PCI_DEVICE_NUMBER_PCH_SERIAL_IO_I2C4          25
#define PCI_FUNCTION_NUMBER_PCH_SERIAL_IO_I2C4        0
//  PCH LP & H Serial IO I2C #5 Controller
#define PCI_DEVICE_NUMBER_PCH_SERIAL_IO_I2C5          25
#define PCI_FUNCTION_NUMBER_PCH_SERIAL_IO_I2C5        1
//  PCH LP & H Serial IO I2C #6 Controller
#define PCI_DEVICE_NUMBER_PCH_SERIAL_IO_I2C6          16
#define PCI_FUNCTION_NUMBER_PCH_SERIAL_IO_I2C6        0
//  PCH LP & H Serial IO I2C #7 Controller
#define PCI_DEVICE_NUMBER_PCH_SERIAL_IO_I2C7          16
#define PCI_FUNCTION_NUMBER_PCH_SERIAL_IO_I2C7        1
#define PCIEX_BASE_ADDRESS							  0xC0000000

UINT8
SerialIoI2cDevNumber(
	IN UINT8       I2cNumber
	);

UINT8
SerialIoI2cFuncNumber(
	IN UINT8       I2cNumber
	);

BOOL
I2cWriteRead(
	IN UINT8  I2cNumber,
	IN UINT8  SlaveAddress,
	IN UINT16 WriteLength,
	IN UINT8  *WriteBuffer,
	IN UINT16 ReadLength,
	IN UINT8  *ReadBuffer,
	IN UINT32  TimeBudget
	);

#endif//__I2CLIB_H__
